<template>
  <div id="app">
    <router-view
        v-if="isStart"/>
  </div>
</template>

<script>

import {isStart} from "@/api/all";

export default {
  name: 'App',
  data() {
    return {
      isStart: false,
      loading: null
    }
  },
  created() {
    // loading
    this.loading=this.$loading({
      lock: true,
      text: '加载中...',
      spinner: 'el-icon-loading',
      background: 'rgba(0, 0, 0, 0.7)'
    });

    this.start();
  },
  methods: {
    start() {
      if (this.isStart) {
        this.loading.close();
        return false;
      }

      isStart().then(res => {
        if (res.code === 2000) {
          this.isStart = true;
          this.loading.close();
          return false;
        }
      }).catch(err => {
        setTimeout(()=>{
          this.start();
        },2000);
      });

    }
  }
}

</script>

<style>
#app {
  /*font-family: Avenir, Helvetica, Arial, sans-serif;*/
  /*-webkit-font-smoothing: antialiased;*/
  /*-moz-osx-font-smoothing: grayscale;*/
  text-align: center;
  color: #2c3e50;
}

nav {
  padding: 30px;
}

nav a {
  font-weight: bold;
  color: #2c3e50;
}

nav a.router-link-exact-active {
  color: #42b983;
}
</style>
